<template>
  <div class="category-management">
    <h2>分类管理</h2>
    <div class="operation-bar">
      <el-button type="primary" @click="handleAdd">新增分类</el-button>
    </div>
    
    <el-table :data="categories" style="width: 100%">
      <el-table-column prop="id" label="ID" width="80" />
      <el-table-column prop="name" label="分类名称" />
      <el-table-column prop="description" label="描述" />
      <el-table-column prop="articleCount" label="文章数量" />
      <el-table-column prop="createTime" label="创建时间" />
      <el-table-column label="操作" width="200">
        <template #default="scope">
          <el-button size="small" @click="handleEdit(scope.row)">编辑</el-button>
          <el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const categories = ref([
  {
    id: 1,
    name: '前端开发',
    description: '前端技术相关文章',
    articleCount: 15,
    createTime: '2024-03-01'
  },
  {
    id: 2,
    name: '后端开发',
    description: '后端技术相关文章',
    articleCount: 8,
    createTime: '2024-03-02'
  },
  {
    id: 3,
    name: 'UI框架',
    description: 'UI框架使用教程',
    articleCount: 5,
    createTime: '2024-03-03'
  }
])

const handleAdd = () => {
  // TODO: 实现新增分类逻辑
}

const handleEdit = (row) => {
  // TODO: 实现编辑分类逻辑
}

const handleDelete = (row) => {
  // TODO: 实现删除分类逻辑
}
</script>

<style scoped>
.category-management {
  padding: 20px;
}

.operation-bar {
  margin-bottom: 20px;
}
</style> 